<?php

namespace app\common\validate;

use think\Validate;

class Teacher extends Validate
{
    protected $regex = ['mobile' => '^1\d{10}$'];

    /**
     * 验证规则
     */
    protected $rule = [
        'card_number' => 'require|unique:Teacher,card_number^school_id'
    ];

    /**
     * 提示消息
     */
    protected $message = [
    ];

    /**
     * 字段描述
     */
    protected $field = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['card_number'],
        'edit' => ['card_number' => 'require|unique:Teacher,name^school_id^id'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'card_number' => '卡号'
        ];
        parent::__construct($rules, $message, $field);
    }

}
